package leetcode.code1413;

public class Solution {
	public int minStartValue(int[] nums) {
		int ans = 0, sum = 0;
		for (int num : nums) {
			sum += num;
			ans += Math.max(1 - sum, 0);
			sum = Math.max(1, sum);
		}
		return Math.max(1, ans);
	}
}
